package com.scott.crm.role.controller;

import com.scott.crm.base.bean.Data;
import com.scott.crm.base.utils.DataUtil;
import com.scott.crm.role.bean.RoleBean;
import com.scott.crm.role.service.RoleService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 黄后林
 * @version 1.0
 * @note
 * @date 2021-12-04 12:29:07
 */
@RestController
@Slf4j
public class RoleController {

    @Autowired
    private RoleService roleService;

    @RequestMapping(value = "/role/{roleId}",method = RequestMethod.GET)
    public Data findRoleById(@PathVariable("roleId") Integer id){

        RoleBean role = roleService.findRoleById(id);
        if(null != role){
            return DataUtil.success(role);
        }
        return DataUtil.errors();
    }


}
